import React,{Component} from 'react';
import {HashRouter as Router,Route,NavLink,Redirect,Switch,WithRouter, withRouter} from 'react-router-dom'
import loadable from '../util/loadable'
// const Mytaobao = loadable(()=>import('./Mytaobao'))
class Login extends Component{
    constructor(){
        super();
        this.state={
            name:''
        }
    }
    componentDidMount(){
      
    }
    user=(e)=>{
        
        this.setState({
            name:e.target.value
        })
    }
    deng=()=>{
        localStorage.setItem('username',this.state.name)
        this.props.history.push('/Mytaobao/home/home ')
    }
    render(){
        return(
            <div className="login">
                <div className="usernameimg">
                    <img src="/img/19.png"/>
                </div>
                <div className="inputs">
                    <input type="text" placeholder="请输入用户账号" className="username" onChange={this.user}/>
                    <input type="text" placeholder="请输入用户密码" className="userpwd"/>
                    <button className="btn" onClick={this.deng}>登录</button>
                </div>
            </div>
        )
    }
}
export default withRouter(Login)